/*
 * @Author: WLang
 * @LastEditors: WLang
 * @Description: 
 * @Date: 2023-06-29 13:48:35
 * @LastEditTime: 2023-07-19 18:49:45
 * @FilePath: \myblog\vue.config.js
 */
const { defineConfig } = require('@vue/cli-service')
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')
var LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin')
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: '',
  configureWebpack: config =>  {
    if (process.env.NODE_ENV === 'production')
    {
     return {
      plugins: [
        new CompressionPlugin({
          test: /\.(js|css)$/,
          threshold: 10240, // 小于10KB就不进行压缩
          deleteOriginalAssets: false // 是否删除源文件
        })
      ]
     }

    }
  },
  chainWebpack: config => {
    if (process.env.NODE_ENV === 'production')
    {
      
    }
    config.optimization.minimize(true)
    config.externals({
      'wangeditor': 'wangEditor',
      'vue': 'Vue'
    })
  }
})
